// @ts-check
/** @type {import('next').NextConfig} */
import bundle from '@next/bundle-analyzer'

const withBundleAnalyzer = bundle({
  enabled: process.env.ANALYZE === 'true'
})

const plugins = [withBundleAnalyzer]

const nextConfig = plugins.reduce((acc, next) => next(acc), {
  async redirects() {
    return [
      {
        source: '/',
        destination: '/dashboard',
        permanent: true
      }
      // // Wildcard path matching
      // {
      //   source: "/blog/:slug",
      //   destination: "/post/:slug",
      //   permanent: true,
      // },
    ]
  },
  images: {
    remotePatterns: [
      {
        protocol: 'https',
        hostname: '**',
        port: '',
        pathname: '/**'
      }
    ]
  },
  pageExtensions: ['ts', 'tsx', 'js', 'jsx', 'md', 'mdx'],
  eslint: {
    dirs: ['src'] // Only run ESLint on the 'pages' and 'utils' directories during production builds (next build)
  },
  reactStrictMode: true,
  swcMinify: true
})

// @ts-ignore
export default nextConfig
